package cn.com.dhcc.turbo.entity.registry.tlq;

import cn.com.dhcc.app.pub.core.consts.TlqConfig;

import com.tongtech.tlq.admin.conf.QCU;
import com.tongtech.tlq.admin.conf.TlqConfException;

public class TlqQcu {
	private String qcuName;//qcu名称
	private int qcuStatus;//QCU状态
	private int localQueMaxNum;//本地队列最大个数
	private int sendQueMaxNum;//发送队列最大个数
	private int remoteQueMaxNum;//远程队列最大个数
	private int clusterQueMaxNum;//集群队列最大个数
	private int virtualQueMaxNum;//虚拟队列最大个数
	private int semPoolMaxNum;//信号灯池的最大数

	//传输参数 
	private int queSendBuff;//队列发送交换区大小，单位kbyte
	private int queRecvBuff;//接收交换区大小
	private int netSendQueMaxNum;//同时处理网络上发送队列的最大数
	private int recvHistoryMsgNum;//网络上发送队列的最大消息数
	private int connIdMaxNum;//客户端连接最大数

	//动态参数
	private int dyLocalQueMsgNum;//动态创建本地队列的最大消息数
	private int dyLocalQueSpaceSize;//本地队列中消息动态可用空间
	private int dyLocalQueDataBuff;//本地队列数据存储区预留空间
	private int dySendQueMsgNum;//动态创建发送队列的最大消息数
	private int dySendQueSpaceSize;//发送队列中消息动态可用空间
	private int dySendQueDataBuff;//发送队列数据存储区预留空间

	public String getQcuName() {
		return qcuName;
	}

	public int getQcuStatus() {
		return qcuStatus;
	}

	public int getLocalQueMaxNum() {
		return localQueMaxNum;
	}

	public int getSendQueMaxNum() {
		return sendQueMaxNum;
	}

	public int getRemoteQueMaxNum() {
		return remoteQueMaxNum;
	}

	public int getClusterQueMaxNum() {
		return clusterQueMaxNum;
	}

	public int getVirtualQueMaxNum() {
		return virtualQueMaxNum;
	}

	public int getSemPoolMaxNum() {
		return semPoolMaxNum;
	}

	public int getQueSendBuff() {
		return queSendBuff;
	}

	public int getQueRecvBuff() {
		return queRecvBuff;
	}

	public int getNetSendQueMaxNum() {
		return netSendQueMaxNum;
	}

	public int getRecvHistoryMsgNum() {
		return recvHistoryMsgNum;
	}

	public int getConnIdMaxNum() {
		return connIdMaxNum;
	}

	public int getDyLocalQueMsgNum() {
		return dyLocalQueMsgNum;
	}

	public int getDyLocalQueSpaceSize() {
		return dyLocalQueSpaceSize;
	}

	public int getDyLocalQueDataBuff() {
		return dyLocalQueDataBuff;
	}

	public int getDySendQueMsgNum() {
		return dySendQueMsgNum;
	}

	public int getDySendQueSpaceSize() {
		return dySendQueSpaceSize;
	}

	public int getDySendQueDataBuff() {
		return dySendQueDataBuff;
	}

	public void setQcuName(String qcuName) {
		this.qcuName = qcuName;
	}

	public void setQcuStatus(int qcuStatus) {
		this.qcuStatus = qcuStatus;
	}

	public void setLocalQueMaxNum(int localQueMaxNum) {
		this.localQueMaxNum = localQueMaxNum;
	}

	public void setSendQueMaxNum(int sendQueMaxNum) {
		this.sendQueMaxNum = sendQueMaxNum;
	}

	public void setRemoteQueMaxNum(int remoteQueMaxNum) {
		this.remoteQueMaxNum = remoteQueMaxNum;
	}

	public void setClusterQueMaxNum(int clusterQueMaxNum) {
		this.clusterQueMaxNum = clusterQueMaxNum;
	}

	public void setVirtualQueMaxNum(int virtualQueMaxNum) {
		this.virtualQueMaxNum = virtualQueMaxNum;
	}

	public void setSemPoolMaxNum(int semPoolMaxNum) {
		this.semPoolMaxNum = semPoolMaxNum;
	}

	public void setQueSendBuff(int queSendBuff) {
		this.queSendBuff = queSendBuff;
	}

	public void setQueRecvBuff(int queRecvBuff) {
		this.queRecvBuff = queRecvBuff;
	}

	public void setNetSendQueMaxNum(int netSendQueMaxNum) {
		this.netSendQueMaxNum = netSendQueMaxNum;
	}

	public void setRecvHistoryMsgNum(int recvHistoryMsgNum) {
		this.recvHistoryMsgNum = recvHistoryMsgNum;
	}

	public void setConnIdMaxNum(int connIdMaxNum) {
		this.connIdMaxNum = connIdMaxNum;
	}

	public void setDyLocalQueMsgNum(int dyLocalQueMsgNum) {
		this.dyLocalQueMsgNum = dyLocalQueMsgNum;
	}

	public void setDyLocalQueSpaceSize(int dyLocalQueSpaceSize) {
		this.dyLocalQueSpaceSize = dyLocalQueSpaceSize;
	}

	public void setDyLocalQueDataBuff(int dyLocalQueDataBuff) {
		this.dyLocalQueDataBuff = dyLocalQueDataBuff;
	}

	public void setDySendQueMsgNum(int dySendQueMsgNum) {
		this.dySendQueMsgNum = dySendQueMsgNum;
	}

	public void setDySendQueSpaceSize(int dySendQueSpaceSize) {
		this.dySendQueSpaceSize = dySendQueSpaceSize;
	}

	public void setDySendQueDataBuff(int dySendQueDataBuff) {
		this.dySendQueDataBuff = dySendQueDataBuff;
	}

	@Override
	public String toString() {
		return "TlqQcu [qcuName=" + qcuName + ", qcuStatus=" + qcuStatus + ", localQueMaxNum=" + localQueMaxNum
				+ ", sendQueMaxNum=" + sendQueMaxNum + ", remoteQueMaxNum=" + remoteQueMaxNum + ", clusterQueMaxNum="
				+ clusterQueMaxNum + ", virtualQueMaxNum=" + virtualQueMaxNum + ", semPoolMaxNum=" + semPoolMaxNum
				+ ", queSendBuff=" + queSendBuff + ", queRecvBuff=" + queRecvBuff + ", netSendQueMaxNum="
				+ netSendQueMaxNum + ", recvHistoryMsgNum=" + recvHistoryMsgNum + ", connIdMaxNum=" + connIdMaxNum
				+ ", dyLocalQueMsgNum=" + dyLocalQueMsgNum + ", dyLocalQueSpaceSize=" + dyLocalQueSpaceSize
				+ ", dyLocalQueDataBuff=" + dyLocalQueDataBuff + ", dySendQueMsgNum=" + dySendQueMsgNum
				+ ", dySendQueSpaceSize=" + dySendQueSpaceSize + ", dySendQueDataBuff=" + dySendQueDataBuff + "]";
	}

	public QCU toQCUDefaultParam() throws TlqConfException {
		QCU qcu = new QCU();
		qcu.setQcuName(this.qcuName);
		qcu.setSemPoolMaxNum(TlqConfig.QCU.SEM_POOL_MAX_NUM);
		qcu.setQueSendBuff(TlqConfig.QCU.QUE_SEND_BUFF);
		qcu.setQueRecvBuff(TlqConfig.QCU.QUE_RECV_BUFF);
		qcu.setDyLocalQueMsgNum(TlqConfig.QCU.DY_LOCAL_QUE_MSG_NUM);
		qcu.setDyLocalQueDataBuff(TlqConfig.QCU.DY_LOCAL_QUE_DATA_BUFF);
		qcu.setDySendQueMsgNum(TlqConfig.QCU.DY_SEND_QUE_MSG_NUM);
		qcu.setDySendQueSpaceSize(TlqConfig.QCU.DY_SEND_QUE_SPACE_SIZE);
		qcu.setDySendQueDataBuff(TlqConfig.QCU.DY_SEND_QUE_DATA_BUFF);
		qcu.setDyLocalQueSpaceSize(TlqConfig.QCU.DY_LOCAL_QUE_SPACE_SIZE);
		qcu.setEventMsgFlag(TlqConfig.QCU.EVENT_MSG_FLAG);
		qcu.setConnIdMaxNum(TlqConfig.QCU.CONNID_MAX_NUM);
		qcu.setDupFileRenameFlag(TlqConfig.QCU.DUP_FILE_RENAME_FLAG);
		
		qcu.setLocalQueMaxNum(TlqConfig.QCU.LQ_NUM);
		qcu.setSendQueMaxNum(TlqConfig.QCU.SQ_NUM);
		return qcu;
	}

	public QCU toQCU() throws TlqConfException {
		QCU qcu = new QCU();
		qcu.setQcuName(this.qcuName);
		qcu.setQcuStatus(this.qcuStatus);
		qcu.setLocalQueMaxNum(this.localQueMaxNum);//本地队列最大个数
		qcu.setSendQueMaxNum(this.sendQueMaxNum); //发送队列最大个数
		qcu.setRemoteQueMaxNum(this.remoteQueMaxNum);//远程队列最大个数
		qcu.setClusterQueMaxNum(this.clusterQueMaxNum);//集群队列最大个数
		qcu.setVirtualQueMaxNum(this.virtualQueMaxNum);//虚拟队列最大个数
		qcu.setSemPoolMaxNum(this.semPoolMaxNum);//信号灯池的最大数

		//传输参数 
		qcu.setQueSendBuff(this.queSendBuff);//队列发送交换区大小，单位kbyte
		qcu.setQueRecvBuff(this.queRecvBuff);//接收交换区大小
		qcu.setNetSendQueMaxNum(this.netSendQueMaxNum);//同时处理网络上发送队列的最大数
		qcu.setRecvHistoryMsgNum(this.recvHistoryMsgNum);//网络上发送队列的最大消息数
		qcu.setConnIdMaxNum(this.connIdMaxNum);//客户端连接最大数

		//动态参数
		qcu.setDyLocalQueMsgNum(this.dySendQueMsgNum);//动态创建本地队列的最大消息数
		qcu.setDyLocalQueSpaceSize(this.dyLocalQueSpaceSize);//本地队列中消息动态可用空间
		qcu.setDyLocalQueDataBuff(this.dyLocalQueDataBuff);//本地队列数据存储区预留空间
		qcu.setDySendQueMsgNum(this.dySendQueMsgNum);//动态创建发送队列的最大消息数
		qcu.setDySendQueSpaceSize(this.dyLocalQueSpaceSize);//发送队列中消息动态可用空间
		qcu.setDySendQueDataBuff(this.dySendQueDataBuff);//发送队列数据存储区预留空间
		return qcu;
	}
	
	
	public void toTlqQcu(QCU qcu) throws TlqConfException {
		this.setQcuName(qcu.getQcuName().valueToString());
		this.setQcuStatus(qcu.getQcuStatus().valueToInt());
		this.setLocalQueMaxNum(qcu.getLocalQueMaxNum().valueToInt());//本地队列最大个数
		this.setSendQueMaxNum(qcu.getSendQueMaxNum().valueToInt()); //发送队列最大个数
		this.setRemoteQueMaxNum(qcu.getRemoteQueMaxNum().valueToInt());//远程队列最大个数
		this.setClusterQueMaxNum(qcu.getClusterQueMaxNum().valueToInt());//集群队列最大个数
		this.setVirtualQueMaxNum(qcu.getVirtualQueMaxNum().valueToInt());//虚拟队列最大个数
		this.setSemPoolMaxNum(qcu.getSemPoolMaxNum().valueToInt());//信号灯池的最大数

		//传输参数 
		this.setQueSendBuff(qcu.getQueSendBuff().valueToInt());//队列发送交换区大小，单位kbyte
		this.setQueRecvBuff(qcu.getQueRecvBuff().valueToInt());//接收交换区大小
		this.setNetSendQueMaxNum(qcu.getNetSendQueMaxNum().valueToInt());//同时处理网络上发送队列的最大数
		this.setRecvHistoryMsgNum(qcu.getRecvHistoryMsgNum().valueToInt());//网络上发送队列的最大消息数
		this.setConnIdMaxNum(qcu.getConnIdMaxNum().valueToInt());//客户端连接最大数

		//动态参数
		this.setDyLocalQueMsgNum(qcu.getDyLocalQueMsgNum().valueToInt());//动态创建本地队列的最大消息数
		this.setDyLocalQueSpaceSize(qcu.getDyLocalQueSpaceSize().valueToInt());//本地队列中消息动态可用空间
		this.setDyLocalQueDataBuff(qcu.getDyLocalQueDataBuff().valueToInt());//本地队列数据存储区预留空间
		this.setDySendQueMsgNum(qcu.getDySendQueMsgNum().valueToInt());//动态创建发送队列的最大消息数
		this.setDySendQueSpaceSize(qcu.getDyLocalQueSpaceSize().valueToInt());//发送队列中消息动态可用空间
		this.setDySendQueDataBuff(qcu.getDySendQueDataBuff().valueToInt());//发送队列数据存储区预留空间
	}
}
